/** * @license * Copyright (c) 2014, 2018, Oracle and/or its affiliates. * The Universal Permissive License (UPL), Version 1.0 */ "use strict";define(["ojs/ojcore","jquery","require","ojs/ojcomponentcore","ojs/ojdomscroller","ojs/ojanimation","promise","ojs/ojdataprovideradapter","ojs/ojkeyset"],function(t,e,i){var n={properties:{as:{type:"string",value:""},currentItem:{type:"any",writeback:!0},data:{type:"oj.TableDataSource|oj.TreeDataSource|oj.DataProvider"},dnd:{type:"object",properties:{drag:{type:"object",properties:{items:{type:"object",properties:{dataTypes:{type:"string|Array"},drag:{type:"function"},dragEnd:{type:"function"},dragStart:{type:"function"}}}}},drop:{type:"object",properties:{items:{type:"object",properties:{dataTypes:{type:"string|Array"},dragEnter:{type:"function"},dragLeave:{type:"function"},dragOver:{type:"function"},drop:{type:"function",properties:{item:{type:"Element"},position:{type:"'before'|'after'|'inside'"},reorder:{type:"boolean"}}}}}}},reorder:{type:"object",properties:{items:{type:"string",enumValues:["disabled","enabled"],value:"disabled"}}}}},drillMode:{type:"string",enumValues:["collapsible","none"],value:"collapsible"},expanded:{type:"KeySet",writeback:!0,value:"new ExpandedKeySet();"},firstSelectedItem:{type:"object",writeback:!0,readOnly:!0,value:{key:null,data:null},properties:{key:{type:"any"},data:{type:"any"}}},groupHeaderPosition:{type:"string",enumValues:["static","sticky"],value:"sticky"},item:{type:"object",properties:{focusable:{type:"boolean|function",value:!0,properties:{datasource:{type:"oj.DataProvider"},index:{type:"number"},key:{type:"K"},data:{type:"D"},parentElement:{type:"Element"},depth:{type:"number"},parentKey:{type:"K"},leaf:{type:"boolean"}}},renderer:{type:"function",properties:{datasource:{type:"oj.DataProvider"},index:{type:"number"},key:{type:"K"},data:{type:"D"},parentElement:{type:"Element"},depth:{type:"number"},parentKey:{type:"K"},leaf:{type:"boolean"}}},selectable:{type:"boolean|function",value:!0,properties:{datasource:{type:"oj.DataProvider"},index:{type:"number"},key:{type:"K"},data:{type:"D"},parentElement:{type:"Element"},depth:{type:"number"},parentKey:{type:"K"},leaf:{type:"boolean"}}}}},scrollPolicy:{type:"string",enumValues:["auto","loadMoreOnScroll"],value:"auto"},scrollPolicyOptions:{type:"Object",properties:{fetchSize:{type:"number",value:25},maxCount:{type:"number",value:500},scroller:{type:"Element"}}},scrollPosition:{type:"object",value:{x:0,y:0},properties:{x:{type:"number"},y:{type:"number"},index:{type:"number"},parent:{type:"any"},key:{type:"any"},offsetX:{type:"number"},offsetY:{type:"number"}}},selection:{type:"Array",writeback:!0,value:[]},selectionMode:{type:"string",enumValues:["multiple","none","single"],value:"none"},selectionRequired:{type:"boolean",value:!1},translations:{type:"object",value:{},properties:{accessibleNavigateSkipItems:{type:"string"},accessibleReorderAfterItem:{type:"string"},accessibleReorderBeforeItem:{type:"string"},accessibleReorderInsideItem:{type:"string"},accessibleReorderTouchInstructionText:{type:"string"},indexerCharacters:{type:"string"},labelCopy:{type:"string"},labelCut:{type:"string"},labelPaste:{type:"string"},labelPasteAfter:{type:"string"},labelPasteBefore:{type:"string"},msgFetchingData:{type:"string"},msgNoData:{type:"string"}}}},methods:{refresh:{},getContextByNode:{},getDataForVisibleItem:{},getIndexerModel:{},scrollToItem:{},setProperty:{},getProperty:{},setProperties:{},getNodeBySubId:{},getSubIdByNode:{}},events:{ojAnimateStart:{},ojAnimateEnd:{},ojBeforeCurrentItem:{},ojBeforeExpand:{},ojBeforeCollapse:{},ojCollapse:{},ojCopy:{},ojCut:{},ojExpand:{},ojPaste:{},ojReorder:{}},extension:{}};t.DataSourceContentHandler=function(t,e,i){this.m_root=e,this.m_widget=t,this.m_fetching=!1,this.setDataSource(i),this.Init()},t.Object.createSubclass(t.DataSourceContentHandler,t.Object,"oj.DataSourceContentHandler"),t.DataSourceContentHandler.prototype.Init=function(){t.DataSourceContentHandler.superclass.Init.call(this)},t.DataSourceContentHandler.prototype.HandleResize=function(t,e){},t.DataSourceContentHandler.prototype.notifyShown=function(){},t.DataSourceContentHandler.prototype.notifyAttached=function(){},t.DataSourceContentHandler.prototype.cleanItems=function(t){var e,i;if(void 0===t&&(t=this.getTemplateEngine()),t&&this.m_root)for(e=this.m_root.childNodes,i=0;i")):t.attr("role","presentation"):(n.attr("role",this.IsHierarchical()?"treeitem":"option"),n!=t&&t.attr("role","presentation")),n.addClass(this.m_widget.getFocusedElementStyleClass()),this.isFocusable(i)||t.addClass("oj-skipfocus"),t.addClass(this.m_widget.getItemElementStyleClass())},t.DataSourceContentHandler.prototype.createContext=function(t,e,i,n){var s,o;for(o in(s={}).parentElement=n,s.index=t,s.data=e,s.component=this.m_widget.getWidgetConstructor(),s.datasource=this.getDataSource(),s=this.m_widget._FixRendererContext(s),i)i.hasOwnProperty(o)&&(s[o]=i[o]);return s},t.DataSourceContentHandler.prototype.isFocusable=function(t){return this.m_widget.getItemFocusable(t)},t.DataSourceContentHandler.prototype.isSelectable=function(t){return this.m_widget.getItemSelectable(t)},t.DataSourceContentHandler.prototype.isCardLayout=function(){return this.m_widget.isCardLayout()},t.DataSourceContentHandler.prototype.shouldUseGridRole=function(){return this.m_widget.ShouldUseGridRole()},t.DataSourceContentHandler.prototype.isAsyncRendering=function(){return!1},t.DataSourceContentHandler.prototype.signalTaskStart=function(t){this.m_widget&&this.m_widget.signalTaskStart("DataSource ContentHandler "+t)},t.DataSourceContentHandler.prototype.signalTaskEnd=function(){this.m_widget&&this.m_widget.signalTaskEnd()},t.TreeDataSourceContentHandler=function(e,i,n){t.TreeDataSourceContentHandler.superclass.constructor.call(this,e,i,n)},t.Object.createSubclass(t.TreeDataSourceContentHandler,t.DataSourceContentHandler,"oj.TreeDataSourceContentHandler"),t.TreeDataSourceContentHandler.prototype.Init=function(){t.TreeDataSourceContentHandler.superclass.Init.call(this)},t.TreeDataSourceContentHandler.prototype.IsHierarchical=function(){return!0},t.TreeDataSourceContentHandler.prototype.fetchRows=function(e){this.signalTaskStart("fetching rows"),t.TreeDataSourceContentHandler.superclass.fetchRows.call(this,e),this.fetchChildren(0,null,this.m_root,null),this.signalTaskEnd()},t.TreeDataSourceContentHandler.prototype.fetchChildren=function(t,i,n,s){var o,l,r,a,h,c=this;this.signalTaskStart("fetching children from index: "+t),o=this.loadTemplateEngine(),null!=i&&(l=n.parentNode.firstElementChild.firstElementChild.firstElementChild)&&(l=e(l),r=this.m_widget.getCollapseIconStyleClass(),l.hasClass(r)&&(a=this.m_widget.getExpandingIconStyleClass(),l.removeClass(r).addClass(a))),this.m_fetching=!0,h={start:t,count:this.m_dataSource.getChildCount(i)},this.signalTaskStart("first fetch"),this.m_dataSource.fetchChildren(i,h,{success:function(t){o.then(function(e){c._handleFetchSuccess(t,i,n,s,e),c.signalTaskEnd()})},error:function(t){c._handleFetchError(t),c.signalTaskEnd()}}),this.signalTaskEnd()},t.TreeDataSourceContentHandler.prototype._handleFetchSuccess=function(i,n,s,o,l){var r,a,h,c,d,u,m,p,g=this;if(null!=this.m_widget){for(this.signalTaskStart("handling successful fetch"),(r=i.getStart())+(a=i.getCount()),h=document.createDocumentFragment(),c=0;c1&&(m=s.parentNode.firstElementChild.firstElementChild,e(m).attr("aria-colspan",a)),this.m_fetching=!1,p=function(){g.m_widget&&(null!=o&&o.call(null,s),g.m_widget.renderComplete())},this.isAsyncRendering()?t.Context.getContext(this.m_root).getBusyContext().whenReady().then(function(){p()}):p(),this.m_initialized=!0,this.signalTaskEnd()}},t.TreeDataSourceContentHandler.prototype.GetBindingContext=function(e){var i=t.TreeDataSourceContentHandler.superclass.GetBindingContext.call(this,e);return i.depth=e.depth,i.leaf=e.leaf,i.parentKey=e.parentKey,i},t.TreeDataSourceContentHandler.prototype.afterRenderItem=function(i,n){var s,o,l,r,a,h,c,d,u;this.signalTaskStart("after rendering an item"),t.TreeDataSourceContentHandler.superclass.afterRenderItem.call(this,i,n),s=this.m_widget.getGroupStyleClass(),o=this.m_widget.getItemStyleClass(),l=this.m_widget.getGroupItemStyleClass(!0),r=this.m_widget.getGroupCollapseStyleClass(),h=this.m_widget.getCollapseIconStyleClass(),a=this.m_widget.getFocusedElementStyleClass(),i=e(i),0==n.leaf?(i.children().wrapAll("
"),i.hasClass(a)?i.removeClass(a).children().first().addClass(a).attr("aria-expanded","false"):i.children().first().attr("role","presentation").find("."+a).attr("aria-expanded","false"),(c=i.children().first()).uniqueId().addClass(l),this.m_widget.isExpandable()&&(i.addClass("oj-collapsed"),d=document.createElement("a"),e(d).attr("href","#").attr("aria-labelledby",c.get(0).id).addClass("oj-component-icon oj-clickable-icon-nocontext").addClass(h),c.prepend(d)),this.shouldUseGridRole()&&(c.get(0).removeAttribute("aria-expanded"),c.removeClass(a),c.attr("role","row"),c.children().wrapAll("")),u=document.createElement("ul"),e(u).addClass(s).addClass(r).attr("role",this.shouldUseGridRole()?this.isCardLayout()?"row":"presentation":"group"),i.append(u)):1==n.leaf&&i.addClass(o),this.m_widget._isSelectionEnabled()&&this.isSelectable(n)&&this.m_widget.getFocusItem(i).attr("aria-selected",!1),this.m_widget.itemRenderComplete(i[0],n),this.signalTaskEnd()},t.TreeDataSourceContentHandler.prototype._handleFetchError=function(e){null!=this.m_widget?(this.signalTaskStart("handling fetch error: "+e),t.Logger.error(e),this.m_widget.renderComplete(),this.signalTaskEnd()):t.Logger.info("handleFetchError: widget has already been destroyed")},t.TreeDataSourceContentHandler.prototype.Expand=function(t,e){var i,n;this.signalTaskStart("expanding an item"),i=this.GetKey(t[0]),n=t.children("ul")[0],this.fetchChildren(0,i,n,e),this.signalTaskEnd()},t.TreeDataSourceContentHandler.prototype.Collapse=function(t){var e=this.getTemplateEngine();e&&e.clean(t.get(0)),t.empty()},t.StaticContentHandler=function(t,e){this.m_widget=t,this.m_root=e},t.Object.createSubclass(t.StaticContentHandler,t.Object,"oj.StaticContentHandler"),t.StaticContentHandler.prototype.Init=function(){t.StaticContentHandler.superclass.Init.call(this)},t.StaticContentHandler.prototype.Destroy=function(){this.m_root.hasAttribute("role")&&(this.restoreContent(this.m_root,0),this.unsetRootAriaProperties(),this.shouldUseGridRole()&&this.isCardLayout()&&!this.IsHierarchical()&&e(this.m_root).children().first().children().unwrap().children().unwrap())},t.StaticContentHandler.prototype.IsReady=function(){return!0},t.StaticContentHandler.prototype.HandleResize=function(t,e){},t.StaticContentHandler.prototype.notifyShown=function(){},t.StaticContentHandler.prototype.notifyAttached=function(){},t.StaticContentHandler.prototype.RenderContent=function(){var t=this.m_root;this.shouldUseGridRole()&&this.isCardLayout()&&!this.IsHierarchical()&&e(t).children("li").length>0&&(e(this.m_root).children().wrapAll("
    • "),t=e(this.m_root).children("li").first().children("ul").first().get(0)),this.modifyContent(t,0),this.setRootAriaProperties(),this.m_widget.renderComplete()},t.StaticContentHandler.prototype.Expand=function(t,i){var n,s;n="."+this.m_widget.getGroupStyleClass(),s=e(t).children(n)[0],e(s).css("display",""),i.call(null,s)},t.StaticContentHandler.prototype.Collapse=function(t){},t.StaticContentHandler.prototype.IsHierarchical=function(){return null==this.m_hier&&(this.m_hier=e(this.m_root).children("li").children("ul").length>0),this.m_hier},t.StaticContentHandler.prototype.restoreContent=function(t,i){var n,s,o,l,r,a,h,c,d,u,m;for(n=this.m_widget.getGroupStyleClass(),s=this.m_widget.getGroupCollapseStyleClass(),o=this.m_widget.getGroupExpandStyleClass(),l=this.m_widget.getGroupItemStyleClass(!0),r=this.m_widget.getItemStyleClass(),a=this.m_widget.getItemElementStyleClass(),h=t.children,c=0;c0&&(d.children("."+l).children().unwrap(),this.shouldUseGridRole()&&this.unsetGroupAriaProperties(d),d.children(".oj-component-icon").remove(),(m=e(u[0])).removeClass(n).removeClass(o).removeClass(s).removeAttr("role"),this.restoreContent(m[0],i+1)))},t.StaticContentHandler.prototype.modifyContent=function(t,i){var n,s,o,l,r,a,h,c,d,u,m,p,g,_,f,y,C;for(n=this.m_widget.getItemStyleClass(),s=this.m_widget.getItemElementStyleClass(),o=this.m_widget.getGroupStyleClass(),l=this.m_widget.getGroupItemStyleClass(!0),r=this.m_widget.getGroupCollapseStyleClass(),a=this.m_widget.getCollapseIconStyleClass(),h=this.m_widget.getFocusedElementStyleClass(),c=t.children,d=this.m_widget.isExpandable(),u=0;u0&&m.addClass(this.m_widget.getDepthStyleClass(i)),this.isFocusable(p)||m.addClass("oj-skipfocus"),(g=m.children("ul")).length>0?(this.m_hier=!0,m.children(":not(ul)").wrapAll("
      "),(_=m.children().first()).addClass(l),(C=this.getItemsCount(g[0]))>0&&(m.hasClass(h)?(m.removeClass(h),_.addClass(h).attr("aria-expanded","false")):(_.attr("role","presentation"),_.find("."+h).attr("aria-expanded","false")),d&&(m.addClass("oj-collapsed"),_.uniqueId(),f=document.createElement("a"),e(f).attr("href","#").attr("role","button").attr("aria-labelledby",_.get(0).id).addClass("oj-component-icon oj-clickable-icon-nocontext").addClass(a),_.prepend(f))),this.shouldUseGridRole()&&this.setGroupAriaProperties(_,C),(y=e(g[0])).addClass(o).addClass(r).attr("role",this.shouldUseGridRole()?this.isCardLayout()?"row":"presentation":"group").css("display","none"),this.modifyContent(y[0],i+1)):m.addClass(n),this.m_widget._isSelectionEnabled()&&this.isSelectable(p)&&this.m_widget.getFocusItem(m).attr("aria-selected",!1),this.m_widget.itemRenderComplete(m[0],p)},t.StaticContentHandler.prototype.setRootAriaProperties=function(){this.shouldUseGridRole()?this.m_root.setAttribute("role","grid"):this.IsHierarchical()?this.m_root.setAttribute("role","tree"):this.m_root.setAttribute("role","listbox")},t.StaticContentHandler.prototype.unsetRootAriaProperties=function(){this.m_root.removeAttribute("role")},t.StaticContentHandler.prototype.getItemsCount=function(t){return e(t).children("li").length},t.StaticContentHandler.prototype.createContext=function(t){var e,i;return(e={}).key=t.attr("id"),e.parentElement=t.children().first()[0],e.index=t.index(),e.data=t[0],e.component=this.m_widget.getWidgetConstructor(),e=this.m_widget._FixRendererContext(e),this.IsHierarchical()&&(e.leaf=0==t.children("ul").length,i=t.parents("li."+this.m_widget.getItemElementStyleClass()),e.depth=i.length,0==i.length?e.parentKey=null:e.parentKey=i.first().attr("id")),e},t.StaticContentHandler.prototype.setAriaProperties=function(t,e){var i=this.m_widget.getSingleFocusableElement(t);this.shouldUseGridRole()?null==e.leaf||e.leaf?this.isCardLayout()?i.attr("role","gridcell"):(t.attr("role","row"),i!=t?i.attr("role","gridcell"):i.children().wrapAll("
      ")):(t.attr("role","presentation"),i!=t&&i.attr("role","gridcell")):(i.attr("role",this.IsHierarchical()?"treeitem":"option"),i!=t&&t.attr("role","presentation")),i.addClass(this.m_widget.getFocusedElementStyleClass())},t.StaticContentHandler.prototype.setGroupAriaProperties=function(t,e){var i=this.m_widget.getFocusedElementStyleClass();t.get(0).removeAttribute("aria-expanded"),t.removeClass(i),t.attr("role","row"),t.children().wrapAll(""),this.isCardLayout()&&e>1&&t.children().first().attr("aria-colspan",e)},t.StaticContentHandler.prototype.unsetGroupAriaProperties=function(t){t.children("div").first().children().unwrap()},t.StaticContentHandler.prototype.unsetAriaProperties=function(t){var i=this.m_widget.getSingleFocusableElement(e(t));i.removeAttr("role"),i.removeAttr("aria-selected"),i.removeAttr("aria-expanded"),i.removeClass(this.m_widget.getFocusedElementStyleClass()),this.shouldUseGridRole()&&!this.isCardLayout()&&(i!=t?(e(t).removeAttr("role"),i.children().first().children().unwrap()):i.children().first().children().unwrap().children().unwrap())},t.StaticContentHandler.prototype.GetKey=function(t){return e(t).attr("id")},t.StaticContentHandler.prototype.FindElementByKey=function(t){return document.getElementById(t)},t.StaticContentHandler.prototype.isFocusable=function(t){return this.m_widget.getItemFocusable(t)},t.StaticContentHandler.prototype.isSelectable=function(t){return this.m_widget.getItemSelectable(t)},t.StaticContentHandler.prototype.isCardLayout=function(){return this.m_widget.isCardLayout()},t.StaticContentHandler.prototype.shouldUseGridRole=function(){return this.m_widget.ShouldUseGridRole()},t.KeyMap=function(){},t.KeyMap.prototype.set=function(t,e){var i;void 0===this._mapKeys&&void 0===this._mapValues&&(this._mapKeys=[],this._mapValues=[]),(i=this._mapKeys.indexOf(t))>-1?this._mapValues.splice(i,1,e):(this._mapKeys.push(t),this._mapValues.push(e))},t.KeyMap.prototype.get=function(t){var e;return this._mapKeys&&this._mapValues&&(e=this._mapKeys.indexOf(t))>-1&&this._mapValues.length>e?this._mapValues[e]:null},t.KeyMap.prototype.deleteValue=function(t){for(var e=this._mapValues.indexOf(t);e>-1;)this._mapValues.splice(e,1),this._mapKeys.splice(e,1),e=this._mapValues.indexOf(t,e)},t._ojListViewExpandedKeySet=function(){t._ojListViewExpandedKeySet.superclass.constructor.call(this)},t.Object.createSubclass(t._ojListViewExpandedKeySet,t.ExpandedKeySet,"ListViewExpandedKeySet");var s=function(i,n){var s=function(){};return t.Object.createSubclass(s,i,""),s.prototype=e.extend(s.prototype,n),s};t._ojListView=s(Object,{LEFT_KEY:37,RIGHT_KEY:39,DOWN_KEY:40,UP_KEY:38,TAB_KEY:9,ENTER_KEY:13,ESC_KEY:27,F2_KEY:113,SPACE_KEY:32,STATE_EXPANDED:0,STATE_COLLAPSED:1,STATE_NONE:2,MINIMUM_ITEM_HEIGHT:20,init:function(e){var i,n=this;this.readinessStack=[],this.element=e.element,this.ojContext=e.ojContext,this.OuterWrapper=e.OuterWrapper,this.options=e,this.element.uniqueId().addClass(this.GetStyleClass()+" oj-component-initnode"),this.OuterWrapper&&this.element[0].setAttribute("data-oj-context",""),this.signalTaskStart("Initializing"),this.SetRootElementTabIndex(),(i=this.GetDnDContext())&&(this.m_dndContext=i,this.ojContext._on(this.element,{dragstart:function(t){return i._handleDragStart(t)},dragenter:function(t){return i._handleDragEnter(t)},dragover:function(t){return i._handleDragOver(t)},dragleave:function(t){return i._handleDragLeave(t)},dragend:function(t){return n.m_preActive=!1,i._handleDragEnd(t)},drag:function(t){return i._handleDrag(t)},drop:function(t){return n.m_preActive=!1,i._handleDrop(t)}})),this.ojContext._on(this.element,{click:function(t){n.HandleMouseClick(t)},touchstart:function(t){n.HandleMouseDownOrTouchStart(t)},touchend:function(t){n.HandleTouchEndOrCancel(t)},touchcancel:function(t){n.HandleTouchEndOrCancel(t)},mousedown:function(t){0===t.button?n._recentTouch()||n.HandleMouseDownOrTouchStart(t):n.m_preActive=!0},mouseup:function(t){n._handleMouseUpOrPanMove(t),n.m_preActive=!1},mouseout:function(t){n._handleMouseOut(t)},mouseover:function(t){n._handleMouseOver(t)},keydown:function(t){n.HandleKeyDown(t)},keyup:function(t){n.HandleKeyUp(t)},ojpanmove:function(t){n._handleMouseUpOrPanMove(t)}}),this.ojContext._on(this.ojContext.element,{focus:function(t){n.HandleFocus(t)},blur:function(t){n.HandleBlur(t)}}),t.AgentUtils.getAgentInfo().browser===t.AgentUtils.BROWSER.FIREFOX&&this._getListContainer().attr("tabIndex",-1),this.ojContext._on(this.ojContext.element,{focusin:function(t){n.HandleFocus(t)},focusout:function(t){n.HandleFocusOut(t)}}),this._registerScrollHandler(),this.ojContext._focusable({applyHighlight:n.ShouldApplyHighlight(),recentPointer:n.RecentPointerCallback(),setupHandlers:function(t,e){n._focusInHandler=t,n._focusOutHandler=e}})},setupResources:function(){this.ojContext.document.bind("touchend.ojlistview touchcancel.ojlistview",this.HandleTouchEndOrCancel.bind(this)),this.InitContentHandler(),this._registerResizeListener(this._getListContainer()[0])},releaseResources:function(){this.ojContext.document.off(".ojlistview"),this.DestroyContentHandler(),this._unregisterResizeListener(this._getListContainer())},afterCreate:function(){this._buildList(),this.signalTaskEnd()},refresh:function(){this._resetInternal(),this.signalTaskStart("Refresh"),this.SetAriaProperties(),this.InitContentHandler(),this._registerScrollHandler(),this.signalTaskEnd()},whenReady:function(){return this.readyPromise},destroy:function(){this.element.removeClass(this.GetStyleClass()+" oj-component-initnode"),this._unregisterResizeListener(this._getListContainer()),this._resetInternal(),t.DomUtils.unwrap(this.element,this._getListContainer())},adjustScrollPositionValueOnRefresh:function(){var t,e;t=null==this.GetOption("scrollPosition")?{}:this.GetOption("scrollPosition"),e=this.GetOption("selection"),this._isSelectionEnabled()&&e.length>0?null!=this.m_selectionFrontier&&this.m_selectionFrontier.length>0?t.key=this.GetKey(this.m_selectionFrontier[0]):t.key=e[0]:(t.y=0,t.key=null,t.index=0),t.x=0,t.offsetX=0,t.offsetY=0,this.SetOption("scrollPosition",t,{_context:{internalSet:!0},changed:!1})},_clearBusyState:function(){if(this.readinessStack&&this.readinessStack.length>0)for(t.Logger.warn("ListView did not end with a clean state, this could happen if ListView is detached before fetch is complete. State: "+this.readinessStack);this.readinessStack.length>0;)this.signalTaskEnd()},_resetInternal:function(){this.UnsetAriaProperties(),this._cleanupTabbableElementProperties(this.element),this.DestroyContentHandler(),this.m_active=null,this.m_isExpandAll=null,this.m_disclosing=null,this.m_itemHeight=null,this.ClearCache(),null!=this.m_dndContext&&this.m_dndContext.reset()},notifyAttached:function(){null!=this.m_contentHandler&&(this.syncScrollPosition(),this.m_contentHandler.notifyAttached())},notifyDetached:function(){this._getListContainer().removeClass("oj-focus-ancestor"),null!=this.m_active&&e(this.m_active.elem).removeClass("oj-focus oj-focus-highlight"),null!=this.m_hoverItem&&this._unhighlightElem(this.m_hoverItem,"oj-hover")},notifyShown:function(){null!=this.m_contentHandler&&(this.syncScrollPosition(),this.m_contentHandler.notifyShown())},getNodeBySubId:function(t){var i,n,s,o;if(null==t)return this.element[0];if("oj-listview-disclosure"===(i=t.subId)||"oj-listview-icon"===i){if(null!=(n=t.key)&&null!=(s=this.FindElementByKey(n))&&(o=e(s).find(".oj-clickable-icon-nocontext").first(),this._isExpandCollapseIcon(o)))return o.get(0)}else if("oj-listview-item"===i&&null!=(n=t.key))return this.FindElementByKey(n);return null},getSubIdByNode:function(t){var e,i;return null!=t&&this._isExpandCollapseIcon(t)&&null!=(e=this.FindItem(t))&&e.length>0&&null!=(i=this.GetKey(e[0]))?{subId:"oj-listview-disclosure",key:i}:null},getContextByNode:function(t){var e,i,n,s;return null!=(e=this.FindItem(t))&&e.length>0&&null!=(i=this.GetKey(e[0]))?(s={subId:"oj-listview-item",key:i,index:(n=e.parent()).children("."+this.getItemElementStyleClass()).index(e)},n.get(0)!=this.element.get(0)&&(s.parent=n.parent().get(0)),e.children().first().hasClass(this.getGroupItemStyleClass())?s.group=!0:s.group=!1,s):null},getDataForVisibleItem:function(t){var i,n,s,o;return null!=(i=t.key)&&(o=this.FindElementByKey(i)),null==o&&(n=t.index,s=null==(s=t.parent)?this.element.get(0):e(s).children("ul."+this.getGroupStyleClass()).first(),o=e(s).children("li").get(n)),null!=o&&e(o).hasClass(this.getItemStyleClass())?this._getDataForItem(o):null},_getDataForItem:function(t){return null==this.GetOption("data")?t:e.data(t,"data")},_unregisterResizeListener:function(e){e&&this._resizeHandler&&t.DomUtils.removeResizeListener(e,this._resizeHandler)},_registerResizeListener:function(e){e&&(null==this._resizeHandler&&(this._resizeHandler=this.HandleResize.bind(this)),t.DomUtils.addResizeListener(e,this._resizeHandler))},GetDnDContext:function(){if(void 0!==t.ListViewDndContext)return new t.ListViewDndContext(this)},HandleResize:function(t,e){t>0&&e>0&&null!=this.m_contentHandler&&this.m_contentHandler.HandleResize(t,e)},ShouldApplyHighlight:function(){return!0},RecentPointerCallback:function(){return function(){return!1}},ShouldRefresh:function(t){return null!=t.data||null!=t.drillMode||null!=t.groupHeaderPosition||null!=t.item||null!=t.scrollPolicy||null!=t.scrollPolicyOptions},_isKeySet:function(t){return t.values&&t.isAddAll},setOptions:function(t,i){var n,s,o,l,r,a=this;if(this.ShouldRefresh(t))return!0;if(null!=t.expanded&&this.m_contentHandler.IsHierarchical())if(this._collapsedKeys=void 0,s=t.expanded,Array.isArray(s)||s.values){this.signalTaskStart("Set expanded option"),this._collapseAll(),this._ignoreExpanded=!0;try{(this._isKeySet(s)?s.values():s).forEach(function(t){a.expandKey(t,!0,!0,!0)})}finally{this._ignoreExpanded=void 0,this.signalTaskEnd()}}else if("all"===s||s.deletedValues)return!0;return null!=t.currentItem?null!=(n=this.FindElementByKey(t.currentItem))&&(n=e(n),this.SkipFocus(n)||((o=document.activeElement)&&this.element.get(0).contains(o)?this.ActiveAndFocus(n,null):this._setActive(n,null,!0))):null===t.currentItem&&(this.UnhighlightActive(),this.m_active=null,this.SetRootElementTabIndex()),this.HandleSelectionOption(t),null!=t.selectionMode&&(this._clearSelection(!0),this.SetAriaProperties(),this.UpdateItemAriaProperties(t.selectionMode)),null!=t.scrollTop&&(l=this._getScroller(),null==(r=t.scrollTop)||isNaN(r)||(l.scrollTop=r)),null!=t.scrollPosition&&(this.syncScrollPosition(t.scrollPosition),delete t.scrollPosition),this._shouldDragSelectedItems()&&null!=this.m_active&&null!=t.dnd&&null!=t.dnd.reorder&&("enabled"===t.dnd.reorder.items?this.m_dndContext._setItemDraggable(this.m_active.elem):"disabled"===t.dnd.reorder.items&&this.m_dndContext._unsetItemDraggable(this.m_active.elem)),!1},HandleSelectionOption:function(t){var e,i,n;if(null!=t.selection&&this._isSelectionEnabled())for(t.selection=this._filterSelection(t.selection),i=t.selection,this._clearSelection(!1),n=0;n0&&(this.readinessStack.pop(),0==this.readinessStack.length&&(this.readyResolve(null),this.busyStateResolve(null),this.busyStateResolve=null))},isReady:function(){return null==this.busyStateResolve},throwError:function(t){if(this.readinessStack)for(;this.readinessStack.length>0;)this.signalTaskEnd();throw t},getItems:function(t){var i,n=this,s=[];return e.each(t,function(t,e){null!=(i=n.FindElementByKey(e))&&s.push(i)}),s},isCardLayout:function(){return(this.ojContext._IsCustomElement()?this.getRootElement():this.element).hasClass("oj-listview-card-layout")},ShouldUseGridRole:function(){return!0},ShouldUpdateScrollPosition:function(){return this.ShouldUseGridRole()&&this.ojContext._IsCustomElement()},DestroyContentHandler:function(){null!=this.m_contentHandler&&(this.m_contentHandler.Destroy(),delete this.m_contentHandler,this.m_contentHandler=null),this._clearBusyState()},InitContentHandler:function(){var e;this.signalTaskStart("Initialize ContentHandler"),this.showStatusText(),null!=(e=this.GetOption("data"))?void 0!==t.TableDataSource&&e instanceof t.TableDataSource?this.m_contentHandler=new t.IteratingDataProviderContentHandler(this,this.element[0],new t.TableDataSourceAdapter(e)):void 0!==t.TreeDataSource&&e instanceof t.TreeDataSource?this.m_contentHandler=new t.TreeDataSourceContentHandler(this,this.element[0],e):t.DataProviderFeatureChecker.isIteratingDataProvider(e)?this.m_contentHandler=new t.IteratingDataProviderContentHandler(this,this.element[0],e):this.throwError("Invalid data or missing module"):this.m_contentHandler=new t.StaticContentHandler(this,this.element[0]),this.m_contentHandler.RenderContent(),this.signalTaskEnd()},UpdateActiveDescendant:function(t){this.element.attr("aria-activedescendant",t.attr("id"))},SetAriaProperties:function(){this._isMultipleSelection()?this.element.attr("aria-multiselectable",!0):this._isSelectionEnabled()&&this.element.attr("aria-multiselectable",!1)},UnsetAriaProperties:function(){this.element.removeAttr("aria-activedescendant").removeAttr("aria-multiselectable")},UpdateItemAriaProperties:function(t){var i,n,s,o=this;for("none"==t?(this.element.removeAttr("aria-multiselectable"),i=function(t){o.getFocusItem(t).removeAttr("aria-selected")}):("single"==t?this.element.attr("aria-multiselectable",!1):this.element.attr("aria-multiselectable",!0),i=function(t){o.getFocusItem(t).attr("aria-selected","false")}),n=this._getItemsCache(),s=0;s0&&"template"===e[0].tagName.toLowerCase()&&(this.m_template=e[0])),this.m_template},itemInsertComplete:function(t,e){},BeforeInsertItem:function(){},itemRemoveComplete:function(t){if(null!=this.m_active&&this.m_active.elem&&e(this.m_active.elem).get(0)==t){var i=t.nextElementSibling;null!=i&&e(i).hasClass(this.getItemElementStyleClass())||null!=(i=t.previousElementSibling)&&e(i).hasClass(this.getItemElementStyleClass())||this.SetOption("currentItem",null),null!=i&&e(i).hasClass(this.getItemElementStyleClass())&&this.SetOption("currentItem",this.GetKey(i))}null!=t&&t.id&&null!=this.m_keyElemMap&&this.m_keyElemMap.deleteValue(t.id)},itemRenderComplete:function(i,n){var s,o,l,r,a,h,c,d;if(null!=this.m_dndContext&&this.m_dndContext.itemRenderComplete(i),this._disableAllTabbableElements(i),s=n.key,this._isSelectionEnabled())if(o=this.GetOption("selection"),this.IsSelectable(i)){for(r=0;r1&&(l=this.FindElementByKey(s),this._setSelectionOption([s],null,l,n.data));break}0==o.length&&this._isSelectionRequired()&&(this._applySelection(i,s),this._setSelectionOption([s],null,[i],n.data))}else if((a=this.GetIndexOf(o,s))>-1){for((h=o.slice(0)).splice(a,1),l=new Array(h.length),r=0;r0&&(this.m_itemHeight=i.get(0).firstElementChild.offsetHeight):(i=e(this._getRootNodeForItems()).children("li."+this.getItemStyleClass()).first()).length>0&&(this.m_itemHeight=i.get(0).offsetHeight)),null!=(n=this.GetOption("currentItem"))&&(null==(s=this.FindElementByKey(n))?this.SetOption("currentItem",null):null!=this.m_active||this.SkipFocus(e(s))||this.ActiveAndFocus(e(s),null)),this._getListContainer().hasClass("oj-focus-ancestor")&&null==this.m_active&&null==n&&this._initFocus(),this.m_scrollAndFetch=void 0,this.m_ticking&&null==this.m_scrollPosition||this.syncScrollPosition(),this.Trigger("ready",null,{})},_isEmptyGrid:function(){return this.ShouldUseGridRole()&&this.isCardLayout()&&!this.m_contentHandler.IsHierarchical()&&this.element[0].children[0]&&0==this.element[0].children[0].children[0].childElementCount},_setScrollY:function(t,e){this._skipScrollUpdate||this.signalTaskStart("waiting for scroll handler"),this._skipScrollUpdate=!0,t.scrollTop=e,this._handlePinGroupHeader()},_setScrollX:function(e,i){this._skipScrollUpdate||this.signalTaskStart("waiting for scroll handler"),this._skipScrollUpdate=!0,t.DomUtils.setScrollLeft(e,i)},_getScrollX:function(e){return t.DomUtils.getScrollLeft(e)},_validatePositionKey:function(e,i){var n,s,o,l=this;return!!((n=e.key)&&null==this.FindElementByKey(n)&&this.m_contentHandler instanceof t.IteratingDataProviderContentHandler&&(s=this.m_contentHandler.getDataSource()).containsKeys)&&((o=new Set).add(n),this.signalTaskStart("Checking for key"),s.containsKeys({keys:o}).then(function(t){l.signalTaskEnd(),i(t.results.size>0)},function(t){l.signalTaskEnd(),i(!1)}),!0)},syncScrollPosition:function(t,e){var i,n,s,o,l,r,a,h=this;if(e=void 0===e||e,(i=this._getScroller()).scrollHeight!=i.clientHeight){if(this.ShouldUpdateScrollPosition()){if(null!=this.m_scrollPosition?t=this.m_scrollPosition:void 0===t&&(t=this.GetOption("scrollPosition")),e&&this._validatePositionKey(t,function(e){e||delete t.key,h.syncScrollPosition(t,!1)}))return;if(s=(n=this._getScrollCoordinates(t)).x,o=n.y,isNaN(s)&&isNaN(o))return void(null!=this.m_scrollPosition&&(this.SetOption("scrollPosition",this._getCurrentScrollPosition(l),{_context:{originalEvent:null,internalSet:!0}}),this.signalTaskEnd(),this.m_scrollPosition=null))}if(void 0===n&&(o=this.GetOption("scrollTop")),l=i.scrollTop,!isNaN(s)&&isNaN(o)||!isNaN(s)&&o==l&&s!=this._getScrollX(i,s))this._setScrollX(i,s),r=this.GetOption("scrollPosition"),a={x:s=this._getScrollX(i),y:r.y,index:r.index,key:r.key,offsetX:s,offsetY:r.offsetY},r.parent&&(a.parent=r.parent),this.SetOption("scrollPosition",a,{_context:{originalEvent:null,internalSet:!0}});else if(o!=l){if(this._setScrollY(i,o),isNaN(s)||s==this._getScrollX(i,s)||this._setScrollX(i,s),l=i.scrollTop,Math.abs(l-o)>=1&&this.m_contentHandler.hasMoreToFetch&&this.m_contentHandler.hasMoreToFetch())return null==this.m_scrollPosition&&this.signalTaskStart("Scroll position needs to resolve further"),this.m_scrollAndFetch=!0,void(this.m_scrollPosition=t);this.SetOption("scrollPosition",this._getCurrentScrollPosition(l),{_context:{originalEvent:null,internalSet:!0}})}else t&&(null==t.key||isNaN(t.index))&&this.SetOption("scrollPosition",this._getCurrentScrollPosition(l),{_context:{originalEvent:null,internalSet:!0}});null!=this.m_scrollPosition&&(this.signalTaskEnd(),this.m_scrollPosition=null)}},restoreCurrentItem:function(){var t=this.GetOption("currentItem");if(null!=t){var i=this.FindElementByKey(t);null==i||this.SkipFocus(e(i))||this.ActiveAndFocus(e(i),null)}},ClearCache:function(){this.m_items=null,this.m_groupItems=null},StartAnimation:function(e,i,n){return null==n&&(n=this.getAnimationEffect(i)),t.AnimationUtils.startAnimation(e,i,n,this.ojContext)},notifyContextMenuGesture:function(t,i,n){var s,o,l;if(this.IsNodeEditableOrClickable(e(i.target)))return!1;s=e(i.target).closest("."+this.getItemElementStyleClass()),this.PrepareContextMenu(s),s.length>0&&!this.SkipFocus(e(s[0]))&&this.SetCurrentItem(e(s[0]),null),l=this.element,2===i.button?l=this._findItem(e(i.target)):null!=this.m_active&&(l=this.m_active.elem),o={launcher:l,initialFocus:"menu"},"keyboard"===n&&(o.position={my:"start top",at:"start bottom",of:this.m_active.elem}),this.ojContext._OpenContextMenu(i,n,o)},PrepareContextMenu:function(t){null!=this.m_dndContext&&this.m_dndContext.prepareContextMenu(this.ojContext._GetContextMenu())},IsElementEditableOrClickable:function(t){return null!=t.prop("nodeName").match(/^INPUT|SELECT|OPTION|BUTTON|^A\b|TEXTAREA/)},IsNodeEditableOrClickable:function(t){for(;null!=t&&t[0]!=this.element[0]&&"LI"!=t.prop("nodeName");)if(3!=t[0].nodeType){var e=t.attr("tabIndex"),i=t.attr("data-oj-tabindex");if(null!=e&&e>=0&&!t.hasClass(this.getFocusedElementStyleClass())&&!t.hasClass("oj-listview-cell-element"))return!0;if(this.IsElementEditableOrClickable(t)&&(-1!=e||-1!=i))return!0;t=t.parent()}else t=t.parent();return!1},_disableAllTabbableElements:function(t,i){var n,s;(n=e(t)).hasClass(this.getItemStyleClass())||(n=e(n.get(0).firstElementChild)),n.children().first().hasClass("oj-listview-cell-element")&&(n=e(n.get(0).firstElementChild)),n.find("a, input, select, textarea, button, object, .oj-component-initnode, [tabIndex]").each(function(t){e(this).removeAttr("data-first").removeAttr("data-last"),s=parseInt(e(this).attr("tabIndex"),10),!(isNaN(s)||s>=0)||void 0!==i&&this==document.activeElement||e(this).attr("tabIndex",-1).attr("data-tabmod",isNaN(s)?-1:s)})},_disableAllTabbableElementsBeforeItem:function(t){var e,i,n;for(i=(e=this._getItemsCache()).index(t),n=0;n<=i;n++)this._disableAllTabbableElements(e[n],!0)},_disableAllTabbableElementsAfterItem:function(t){var e,i,n;if(-1!=(i=(e=this._getItemsCache()).index(t)))for(n=i;n<=e.length-1;n++)this._disableAllTabbableElements(e[n],!0)},_enableAllTabbableElements:function(t){var i,n;(i=(i=e(t).find("[data-tabmod]").each(function(t){n=parseInt(e(this).attr("data-tabmod"),10),e(this).removeAttr("data-tabmod"),-1==n?e(this).removeAttr("tabIndex"):e(this).attr("tabIndex",n)})).filter(":visible")).first().attr("data-first","true"),i.last().attr("data-last","true")},_cleanupTabbableElementProperties:function(t){e(t).find("[data-tabmod]").removeAttr("tabIndex").removeAttr("data-tabmod").removeAttr("data-first").removeAttr("data-last")},SkipFocus:function(t){return t.hasClass("oj-skipfocus")},GetFocusElement:function(){var t;if(this._getListContainer().hasClass("oj-focus-ancestor")){if(this.m_active)return this.getFocusItem(this.m_active.elem)[0];if((t=this.element.children("."+this.getEmptyTextStyleClass()).first()).length>0&&0==t.attr("tabIndex"))return t[0]}return this.element[0]},_isFocusBlurTriggeredByDescendent:function(t){return void 0===t.relatedTarget||!(null==t.relatedTarget||!e.contains(this.ojContext.element.get(0),t.relatedTarget))},HandleFocus:function(t){var i;this._getListContainer().addClass("oj-focus-ancestor"),null==this.m_active?(i=this._findItem(e(t.target)),this.m_preActive||this._isFocusBlurTriggeredByDescendent(t)||null!=i&&!this.SkipFocus(i)||this._initFocus(t)):(this.m_preActive||t.target!==this.ojContext.element[0]||this._isFocusBlurTriggeredByDescendent(t)||(this.HighlightActive(),this._focusItem(this.m_active.elem)),this.RemoveRootElementTabIndex(),this._setTabIndex(this.m_active.elem))},_initFocus:function(t){var i,n,s,o;for(i=this._getItemsCache(),n=0;n0&&(o.attr("tabIndex",0),o.focus(),this.RemoveRootElementTabIndex())},HandleFocusOut:function(t){this.HandleBlur(t)},_supportRelatedTargetOnBlur:function(){var e=t.AgentUtils.getAgentInfo();return!(e.browser==t.AgentUtils.BROWSER.FIREFOX&&parseInt(e.browserVersion,10)<48)},_isExtraBlurEvent:function(e){var i=t.AgentUtils.getAgentInfo();return null==e.relatedTarget&&i.browser==t.AgentUtils.BROWSER.IE&&e.target==this.ojContext.element.get(0)},HandleBlur:function(t){this._supportRelatedTargetOnBlur()&&!this._isExtraBlurEvent(t)&&(this._isFocusBlurTriggeredByDescendent(t)||this.m_preActive||this._doBlur(),this._isExpandCollapseIcon(t.target)&&this._focusOutHandler(e(t.target)))},_doBlur:function(){var t;this._getListContainer().removeClass("oj-focus-ancestor"),this.UnhighlightActive(),null!=this.m_active?(this._resetTabIndex(this.m_active.elem),this._removeSkipItemAriaLabel(this.m_active.elem)):(t=this.element.children("."+this.getEmptyTextStyleClass()).first()).length>0&&t.removeAttr("tabIndex"),this.SetRootElementTabIndex()},_handleMouseOut:function(t){var e=this.FindItem(t.target);null!=e&&(this.m_hoverItem=null,this._unhighlightElem(e,"oj-hover"))},_handleMouseOver:function(t){if(!this._recentTouch()){var e=this.FindItem(t.target);null==e||this.SkipFocus(e)||(this.m_hoverItem=e,this._highlightElem(e,"oj-hover"))}},_recentTouch:function(){return Date.now()-this._lastTouch<500},HandleKeyDown:function(t){var e,i,n;if(this.isExpandable()&&((e=t.keyCode)===this.LEFT_KEY||e===this.RIGHT_KEY))if(i=this.m_active.elem,e===this.LEFT_KEY){if(this.GetState(i)==this.STATE_EXPANDED)return void this.CollapseItem(i,t,!0,this.m_active.key,!0,!0)}else if(this.GetState(i)==this.STATE_COLLAPSED)return void this.ExpandItem(i,t,!0,this.m_active.key,!0,!0,!0);n=this.HandleSelectionOrActiveKeyDown(t),null!=this.m_dndContext&&(n=n||this.m_dndContext.HandleKeyDown(t)),!0===n&&t.preventDefault(),this.m_keyProcessed=n},HandleKeyUp:function(t){t.keyCode==this.ESC_KEY&&this.m_keyProcessed&&t.stopPropagation(),this.m_keyProcessed=void 0},_handleMouseUpOrPanMove:function(t){this.m_preActiveItem&&this._unhighlightElem(this.m_preActiveItem,"oj-focus"),null!=this.m_dndContext&&this.m_dndContext._unsetDraggable(e(t.target))},HandleMouseDownOrTouchStart:function(t){var i,n;n=e(t.target),null!=this.m_dndContext&&this.m_dndContext._setDraggable(n),null!=(i=this._findItem(n,!0))&&this._isClickthroughDisabled(i)&&(this.m_preActive=!0,i=null),null==i||0==i.length||this.SkipFocus(i)||n.hasClass("oj-listview-drag-handle")||(this.m_preActive=!0,this._getListContainer().hasClass("oj-focus-ancestor")||this._getListContainer().addClass("oj-focus-ancestor"),this.m_preActiveItem=i,this._highlightElem(i,"oj-focus"),this._makeFocusable(i),i.get(0).contains(document.activeElement)||this._focusItem(i),this.RemoveRootElementTabIndex(),null!=this.m_active&&this.m_active.elem.get(0)!=i.get(0)&&this._resetTabIndex(this.m_active.elem),t.originalEvent.touches&&t.originalEvent.touches.length>0&&(this.m_touchPos={x:t.originalEvent.changedTouches[0].pageX,y:t.originalEvent.changedTouches[0].pageY}))},HandleTouchEndOrCancel:function(t){var e,i,n,s;null!=this.m_preActiveItem&&(this._unhighlightElem(this.m_preActiveItem,"oj-focus"),null!=this.m_touchPos&&(e=this.m_preActiveItem.offset(),(i=this.getAnimationEffect("pointerUp")).offsetX=this.m_touchPos.x-e.left+"px",i.offsetY=this.m_touchPos.y-e.top+"px",n=(s=this.m_preActiveItem.children("."+this.getGroupItemStyleClass())).length>0?s.get(0):this.getFocusItem(this.m_preActiveItem).get(0),this.StartAnimation(n,"pointerUp",i),this.m_touchPos=null)),this._lastTouch=Date.now(),this._handleMouseOut(t)},_enterActionableMode:function(){var t;t=this.m_active.elem,this._disableAllTabbableElements(t),this._enableAllTabbableElements(t),t.find("[data-first]").length>0&&this._setActionableMode(!0)},_exitActionableMode:function(){this._setActionableMode(!1),this._disableAllTabbableElements(this.m_active.elem)},HandleMouseClick:function(t){var i,n,s,o,l;if(0===t.button)if(i=this.getCollapseIconStyleClass(),n=this.getExpandIconStyleClass(),s=this.getGroupItemStyleClass(),(o=e(t.target)).hasClass(n))this._collapse(t),t.preventDefault();else if(o.hasClass(i))this._expand(t),t.preventDefault();else{if(null==(l=this._findItem(o))||0==l.length||this.SkipFocus(l))return;if(this._isActionableMode()&&null!=this.m_active&&this.m_active.elem.get(0)!=l.get(0)&&this._exitActionableMode(),this._getListContainer().hasClass("oj-focus-ancestor")||this._getListContainer().addClass("oj-focus-ancestor"),this._isSelectionEnabled()&&this.IsSelectable(l[0])?(this._isTouchSupport()?this._handleTouchSelection(l,t):this.HandleClickSelection(l,t),this.ShouldUseGridRole()&&t.target==l.get(0)&&this._focusItem(l),this._shouldDragSelectedItems()&&this.m_dndContext.setSelectionDraggable()):this.HandleClickActive(l,t),this._isInputElement(o.get(0)))return void this._enterActionableMode();this.isExpandable()&&o.closest("."+s)&&(this.GetState(l)==this.STATE_COLLAPSED?this._expand(t):this.GetState(l)==this.STATE_EXPANDED&&this._collapse(t))}},_shouldDragSelectedItems:function(){return null!=this.m_dndContext&&!this.m_dndContext.shouldDragCurrentItem()},_isTouchSupport:function(){return t.DomUtils.isTouchSupported()},_isNonWindowTouch:function(){return this._isTouchSupport()&&t.AgentUtils.getAgentInfo().os!=t.AgentUtils.OS.WINDOWS},_ctrlEquivalent:function(e){return t.DomUtils.isMetaKeyPressed(e)},_createSubId:function(t){return[this.element.attr("id"),t].join(":")},FindItem:function(t){return e(t).closest("."+this.getItemElementStyleClass())},_isClickthroughDisabled:function(t){return t.hasClass("oj-clickthrough-disabled")},_findItem:function(t,e){for(var i=t;i.length>0;){if(this._isClickthroughDisabled(i))return e?i:null;if(i.hasClass(this.getItemElementStyleClass()))return i;i=i.parent()}return null},_getListContainerBorderWidth:function(){return null==this.m_borderWidth&&(this.m_borderWidth=parseInt(this._getListContainer().css("border-top-width"),10)+parseInt(this._getListContainer().css("border-bottom-width"),10)),this.m_borderWidth},scrollToItem:function(t){var i,n,s;null!=(i=t.key)&&null!=(n=this.FindElementByKey(i))&&(e(n).hasClass(this.getItemStyleClass())?this._scrollToVisible(n):(s=e(n).children("."+this.getGroupItemStyleClass()).first(),this._scrollToGroupHeader(s.get(0))))},_scrollToVisible:function(t){var i,n,s,o,l,r,a,h,c=0;i=t.offsetTop,n=t.offsetHeight,o=(s=this._getListContainer()[0]).scrollTop,l=s.offsetHeight,null!=this.m_groupItemToPin&&(r=parseInt(this.m_groupItemToPin.style.top,10),a=e(this.m_groupItemToPin).outerHeight(),i<=r&&r=r&&i=o&&i+n<=o+l?c>0&&(s.scrollTop=o-c):((h=Math.max(0,Math.min(i-c,Math.abs(i+n-l))))>o&&(h+=this._getListContainerBorderWidth()),s.scrollTop=h)},GetKey:function(t){return this.m_contentHandler.GetKey(t)},FindElementByKey:function(t){var e;return null!=this.m_keyElemMap&&null!=(e=this.m_keyElemMap.get(t))?document.getElementById(e):this.m_contentHandler.FindElementByKey(t)},GetIndexOf:function(e,i){var n;for(n=0;n=0){for(l=e(s[o]);this.SkipFocus(l);){if(--o<0)return;l=e(s[o])}i?(this._extendSelection(l,n),this.m_isNavigate=!1):(this.SetCurrentItem(l,n),this.m_isNavigate=!0)}},_getColumnCount:function(t){var e,i,n;return t.each(function(t){if(i=this.offsetTop,void 0===n)n=i;else if(n!=i)return!1;e=t}),e+1},_updateSkipItemAriaLabel:function(t,i){var n,s,o;n=this._createSubId("extra_info"),null==this.m_skipAriaLabelText&&((s=e(document.createElement("div"))).addClass("oj-helper-hidden-accessible").attr("id",n),this._getListContainer().append(s),this.m_skipAriaLabelText=s),this.m_skipAriaLabelText.text(this.ojContext.getTranslatedString("accessibleNavigateSkipItems",{numSkip:i})),(o=this.getFocusItem(t)).uniqueId().attr("aria-labelledby",n+" "+o.prop("id"))},_removeSkipItemAriaLabel:function(t){var e=this.getFocusItem(t);e.length>0&&e.get(0).removeAttribute("aria-labelledby")},_gotoItemAbove:function(t,i,n){var s,o,l,r,a,h,c;if(t.hasClass(this.getItemStyleClass())){if(o=(s=t.parent()).children("li."+this.getItemStyleClass()),l=this._getColumnCount(o),(a=(r=o.index(t))-l)<0?s.hasClass(this.getGroupStyleClass())&&(h=s.parent(),c=r):(h=e(o.get(a)),c=l-1),h.length>0){if(this.SkipFocus(h))return;i?(this._extendSelection(h,n),this.m_isNavigate=!1):(null!=c&&c>0&&this._updateSkipItemAriaLabel(h,c),this.SetCurrentItem(h,n),this.m_isNavigate=!0)}}else this._gotoPrevItem(t)},_gotoItemBelow:function(t,i,n){var s,o,l,r,a,h,c,d;if(t.hasClass(this.getItemStyleClass())){if(o=(s=t.parent()).children("li."+this.getItemStyleClass()),l=this._getColumnCount(o),(a=(r=o.index(t))+l)>=o.length?(h=Math.ceil(o.length/l),d=o.length-1-r,r0){if(this.SkipFocus(c))return;i?(this._extendSelection(c,n),this.m_isNavigate=!1):(null!=d&&d>0&&this._updateSkipItemAriaLabel(c,d),this.SetCurrentItem(c,n),this.m_isNavigate=!0)}}else this._gotoNextItem(t)},_isActionableMode:function(){return"actionable"==this.m_keyMode},_setActionableMode:function(t){this.m_keyMode=t?"actionable":"navigation",t||this.element[0].focus()},getFocusItem:function(t){var i;return t.hasClass(this.getFocusedElementStyleClass())?this.ShouldUseGridRole()&&"row"==t.attr("role")?0==(i=t.children(".oj-listview-cell-element").first()).length?t.children().first():i:t:e(t.find("."+this.getFocusedElementStyleClass()).first())},SetRootElementTabIndex:function(){this.element.attr("tabIndex",0)},RemoveRootElementTabIndex:function(){this.element.removeAttr("tabIndex")},_setTabIndex:function(t){this.getFocusItem(t).attr("tabIndex",0)},_resetTabIndex:function(t){var e;e=!0,"presentation"===t.attr("role")&&(e=!1),t=this.getFocusItem(t),e?t.removeAttr("tabIndex"):t.attr("tabIndex",-1)},_makeFocusable:function(t){this._setTabIndex(t)},getSingleFocusableElement:function(t){var e,i;return e="a, input, select, textarea, button",1===(i=t.children(e)).length&&0===i.first().find(e).length?i.first():t},_setCurrentItemOption:function(t,i,n){var s={item:this.ojContext._IsCustomElement()?n:e(n)};this.SetOption("currentItem",t,{_context:{originalEvent:i,internalSet:!0,extraData:s},changed:!0})},_setActive:function(t,e,i){var n,s,o,l;if(null!=t){if(n=t[0],s=this.GetKey(n),null==this.m_active||s!=this.m_active.key)return o={key:s,item:t},null!=this.m_active&&(o.previousKey=this.m_active.key,o.previousItem=this.m_active.elem,this._shouldDragSelectedItems()&&this._isTouchSupport()&&this.m_dndContext._unsetDraggable(o.previousItem),this._removeSkipItemAriaLabel(o.previousItem)),!!this.Trigger("beforeCurrentItem",e,o)&&(l={key:s,elem:t},this.m_active=l,this._shouldDragSelectedItems()&&this._isTouchSupport()&&this.m_dndContext._setDraggable(t),void 0!==i&&i||(this._makeFocusable(t),this.HighlightActive(),(null==e||e.originalEvent&&"click"!=e.originalEvent.type)&&this._focusItem(t),this.RemoveRootElementTabIndex(),o.previousItem&&this._resetTabIndex(o.previousItem)),!0);s==this.m_active.key&&(l={key:s,elem:t},this.m_active=l,void 0!==i&&i||(this._makeFocusable(t),this.RemoveRootElementTabIndex()))}else this.m_active=null;return!1},_focusItem:function(t){this.getFocusItem(t).focus()},HighlightActive:function(){var t;null!=this.m_active&&this._getListContainer().hasClass("oj-focus-ancestor")&&(t=this.m_active.elem,this._highlightElem(t,"oj-focus"))},UnhighlightActive:function(){null!=this.m_active&&this._unhighlightElem(this.m_active.elem,"oj-focus")},HandleClickActive:function(t,i){var n=null!=this.m_active?this.m_active.elem.get(0):null;null==n||e(n).hasClass(this.getItemStyleClass())||(n=n.firstElementChild),null!=i&&null!=n&&n!=i.target&&n.contains(i.target)||this.SetCurrentItem(t,i,!this.ShouldUseGridRole()||i.target!=t.get(0))},SetCurrentItem:function(t,e,i){this.ActiveAndFocus(t,e,i)&&this._setCurrentItemOption(this.GetKey(t[0]),e,t.get(0))},ActiveAndFocus:function(t,e,i){var n;return this._scrollToVisible(t[0]),this.UnhighlightActive(),n=this._setActive(t,e,i),this.HighlightActive(),n},enforceSelectionRequired:function(){var t;this._isSelectionEnabled()&&this._isSelectionRequired()&&(null!=(t=this.GetOption("selection"))&&0!=t.length||this._selectFirstSelectableItem())},_getFirstSelectableItem:function(){var t=this.element[0].querySelector(".oj-listview-cell-element[aria-selected]");return null==t?null:t.parentNode},_selectFirstSelectableItem:function(){var t,e;(t=this._getFirstSelectableItem())&&null!=(e=this.m_contentHandler.GetKey(t))&&(this._applySelection(t,e),this._setSelectionOption([e],null,[t]))},_isSelectionEnabled:function(){return"none"!=this.GetOption("selectionMode")},_isSelectionRequired:function(){return this.GetOption("selectionRequired")},_isMultipleSelection:function(){return"multiple"==this.GetOption("selectionMode")},IsSelectable:function(t){return(t=this.getFocusItem(e(t)).get(0)).hasAttribute("aria-selected")},_filterSelection:function(t){var e,i,n;for(e=[],i=0;i0&&(a={key:i[0],data:null!=o?o:this.getDataForVisibleItem({key:i[0]})}),this.SetOption("firstSelectedItem",a,{_context:{originalEvent:n,internalSet:!0},changed:!0})),r={items:this.ojContext._IsCustomElement()?s:e(null==s?{}:s)},this.SetOption("selection",i,{_context:{originalEvent:n,internalSet:!0,extraData:r},changed:!0})},_unhighlightSelection:function(){var t,i;null!=this.m_keyElemMap&&(t=this,e.each(this.GetOption("selection"),function(e,n){null!=(i=t.FindElementByKey(n))&&t._unhighlightElem(i,"oj-selected")}))},_highlightElem:function(t,e){this.HighlightUnhighlightElem(t,e,!0)},_unhighlightElem:function(t,e){this.HighlightUnhighlightElem(t,e,!1)},HighlightUnhighlightElem:function(t,i,n){var s;t=e(t),"oj-selected"==i&&this.getFocusItem(t).attr("aria-selected",n?"true":"false"),(s=t.children("."+this.getGroupItemStyleClass())).length>0&&(t=e(s[0])),"oj-focus"===i?n?"actionable"!=this.m_keyMode&&this._focusInHandler(t):this._focusOutHandler(t):n?t.addClass(i):t.removeClass(i)},HandleClickSelection:function(t,e){var i,n;this._scrollToVisible(t[0]),i=this._ctrlEquivalent(e),n=e.shiftKey,this._isMultipleSelection()&&(i||n)?!i&&n?this._extendSelection(t,e):this._augmentSelectionAndFocus(t,e):this.SelectAndFocus(t,e)},_handleTouchSelection:function(t,e){this._isMultipleSelection()?e.shiftKey?this._extendSelection(t,e):this._augmentSelectionAndFocus(t,e):this.SelectAndFocus(t,e)},_clearSelection:function(t,e){this._unhighlightSelection(),t&&(this._isSelectionRequired()?this._selectFirstSelectableItem():this._setSelectionOption([],null,null)),this.m_selectionFrontier=void 0===e?null:e},SelectAndFocus:function(t,e){var i,n,s;i=this.GetKey(t[0]),n=this.GetOption("selection"),s=this.GetIndexOf(n,i),this._clearSelection(s>-1),-1==s&&this._augmentSelectionAndFocus(t,e,[])},_extendSelection:function(t,e){null!=this.m_active&&this.m_selectionFrontier!=t&&(this._unhighlightElem(t,"oj-focus"),this._extendSelectionRange(this.m_active.elem,t,e))},_extendSelectionRange:function(t,e,i,n){!0===n?this._clearSelection(!1,this.m_selectionFrontier):this._clearSelection(!1,e),this._highlightRange(t,e,i),this.HighlightActive(),this._scrollToVisible(e[0])},_highlightRange:function(t,e,i){var n,s,o,l,r,a,h,c,d,u;for(n=[],s=[],(l=(o=this._getItemsCache()).index(t))>(r=o.index(e))?(a=r,h=l):(a=l,h=r),c=a;c<=h;c++)d=o[c],this.IsSelectable(d)&&(u=this.m_contentHandler.GetKey(d),this._applySelection(d,u),n.push(u),s.push(d));this._setSelectionOption(n,i,s)},_applySelection:function(i,n){null==this.m_keyElemMap&&(this.m_keyElemMap=new t.KeyMap),this.m_keyElemMap.set(n,e(i).attr("id")),this._highlightElem(i,"oj-selected")},_augmentSelectionAndFocus:function(t,i,n){var s,o,l,r,a,h;if(s=t,o=this.GetKey(t[0]),null==n&&(n=this.GetOption("selection").slice(0)),null==(l=null!=this.m_active?this.m_active.elem.get(0):null)||e(l).hasClass(this.getItemStyleClass())||(l=l.firstElementChild),null==i||null!=l&&l!=i.target&&l.contains(i.target)||(this.UnhighlightActive(),this._setActive(s,i)&&this._setCurrentItemOption(o,i,s.get(0)),this.HighlightActive()),null!=(l=null!=this.m_active?this.m_active.elem.get(0):null)&&l==s.get(0)){for((r=this.GetIndexOf(n,o))>-1?(this._unhighlightElem(t,"oj-selected"),n.splice(r,1)):(this.m_selectionFrontier=t,this._applySelection(t,o),n.push(o)),a=new Array(n.length),h=0;h-1){if(i||1==n.length&&this._isSelectionRequired())return;this._unhighlightElem(o,"oj-selected"),n.splice(r,1),0==n.length&&(this.m_selectionFrontier=null)}else this.IsSelectable(o[0])&&(e||(this._clearSelection(!1),n.length=0),this.m_selectionFrontier=o,this._applySelection(o,l),n.push(l));for(s=new Array(n.length),a=0;a0&&l.length>0&&o!=l&&t.target==o[0]&&(l[0].focus(),r=!0):o.length>0&&l.length>0&&o!=l&&t.target==l[0]&&(o[0].focus(),r=!0)):e==this.F2_KEY?(this._enterActionableMode(),(o=i.find("[data-first]")).length>0&&(o[0].focus(),this._isExpandCollapseIcon(o)&&this._focusInHandler(o),i.hasClass(this.getItemStyleClass())||(i=i.children("."+this.getGroupItemStyleClass()).first()),i.removeClass("oj-focus-highlight"))):e==this.SPACE_KEY&&this._isSelectionEnabled()?(n=this._ctrlEquivalent(t),(s=t.shiftKey)&&!n&&null!=this.m_selectionFrontier&&this._isMultipleSelection()?this._extendSelectionRange(this.m_selectionFrontier,this.m_active.elem,t,!0):this.ToggleSelection(t,n&&!s&&this._isMultipleSelection(),!1),r=!0):e==this.ENTER_KEY&&this._isSelectionEnabled()?this.ToggleSelection(t,!1,!0):this.IsArrowKey(e)?(n=this._ctrlEquivalent(t),s=t.shiftKey,n||(r=this.HandleArrowKeys(e,s&&this._isSelectionEnabled()&&this._isMultipleSelection(),t))):e===this.TAB_KEY&&(t.shiftKey?this._disableAllTabbableElementsBeforeItem(i):this._disableAllTabbableElementsAfterItem(i)),r)},_isDisclosing:function(t){return!(!t||!this.m_disclosing)&&this.m_disclosing.indexOf(t)>-1},_setDisclosing:function(t,e){var i;if(null!=t)if(null==this.m_disclosing&&(this.m_disclosing=[]),e)this.m_disclosing.push(t);else for(i=this.m_disclosing.indexOf(t);i>-1;)this.m_disclosing.splice(i,1),i=this.m_disclosing.indexOf(t)},getAnimationEffect:function(e){var i;return null==this.defaultOptions&&(this.defaultOptions=t.ThemeUtils.parseJSONFromFontFamily(this.getOptionDefaultsStyleClass())),null==(i=this.defaultOptions.animation)?null:i[e]},isExpandable:function(){return"none"!=this.GetOption("drillMode")},_isExpandAll:function(){var e=this.GetOption("expanded");if("auto"===e){if(!this.isExpandable())return!0}else if("all"===e)return!0;return!!e.isAddAll&&(!this.isExpandable()&&e instanceof t._ojListViewExpandedKeySet||e.isAddAll())},expandKey:function(t,i,n,s,o){var l=this.FindElementByKey(t);null!=l&&this.ExpandItem(e(l),null,o,t,i,s,n)},_expand:function(t){var e=this.FindItem(t.target);null!=e&&e.length>0&&this.ExpandItem(e,t,!0,null,!0,!0,!0)},ExpandItem:function(t,e,i,n,s,o,l){var r,a;this.GetState(t)==this.STATE_COLLAPSED&&(null==n&&(n=this.GetKey(t[0])),i&&this._isDisclosing(n)||(r={item:t,key:n},l&&!this.Trigger("beforeExpand",e,r)&&s||(this.signalTaskStart("Expand item: "+n),i&&this._setDisclosing(n,!0),this.m_contentHandler.Expand(t,function(t){this._expandSuccess(t,i,e,r,o)}.bind(this)),this.m_items=null,null!=e&&e.stopPropagation(),this.ojContext._IsCustomElement()||null==this._collapsedKeys||-1!=(a=this._collapsedKeys.indexOf(n))&&this._collapsedKeys.splice(a,1),this.signalTaskEnd())))},_expandSuccess:function(t,i,n,s,o){var l,r,a,h,c,d,u,m,p=this;this.signalTaskStart("Handle results from successful expand"),t.key=s.key,l=this.AnimateExpand(e(t),i,n),r=t.parentNode,r=e(r),this.SetState(r,this.STATE_EXPANDED),a=this.getCollapseIconStyleClass(),h=this.getExpandIconStyleClass(),c=this.getExpandingIconStyleClass(),d=this.getGroupItemStyleClass(),r.children("."+d).find("."+a+", ."+c).removeClass(a).removeClass(c).addClass(h),o&&l.then(function(){p.ojContext._IsCustomElement()&&(u=p.GetOption("expanded"),p._isKeySet(u)&&!u.has(t.key)&&(m=u.add([t.key]),p.SetOption("expanded",m,{_context:{originalEvent:n,internalSet:!0},changed:!0}))),p.Trigger("expand",n,s)}),l.then(function(){p.signalTaskEnd()})},_adjustAncestorsMaxHeight:function(t,i){var n;t.parentsUntil("ul.oj-component-initnode","ul."+this.getGroupStyleClass()).each(function(t){(n=parseInt(e(this).css("maxHeight"),10))>0&&e(this).css("maxHeight",n+i+"px")})},AnimateExpand:function(t,i,n){var s,o,l,r=0,a=this;return s=new Promise(function(t,e){o=t}),i?(this.signalTaskStart("Animate expand of group item"),t.children().each(function(){r+=e(this).outerHeight(!0)}),this._isTouchSupport()&&this._adjustAncestorsMaxHeight(t,r),t.css("maxHeight",r+"px"),this.signalTaskStart("Kick off expand animation"),l=t.get(0),this.StartAnimation(l,"expand").then(function(e){a._handleExpandTransitionEnd(t,o)}),this.signalTaskEnd()):(this._isTouchSupport()?(t.children().each(function(){r+=e(this).outerHeight(!0)}),t.css("maxHeight",r+"px"),this._adjustAncestorsMaxHeight(t,r)):t.css("maxHeight",""),this.AnimateExpandComplete(t),o(null)),s},_handleExpandTransitionEnd:function(t,e){this._isTouchSupport()||t.css("maxHeight",""),this.AnimateExpandComplete(t),e(null),this.signalTaskEnd()},AnimateExpandComplete:function(t){t.removeClass(this.getGroupCollapseStyleClass()).addClass(this.getGroupExpandStyleClass()),this._setDisclosing(t[0].key,!1)},collapseKey:function(t,i,n,s){var o=this.FindElementByKey(t);null!=o&&this.CollapseItem(e(o),null,s,t,i,n)},_collapse:function(t){var e=this.FindItem(t.target);null!=e&&e.length>0&&this.CollapseItem(e,t,!0,null,!0,!0)},CollapseItem:function(t,e,i,n,s,o){var l,r,a,h,c,d,u=this;this.GetState(t)==this.STATE_EXPANDED&&(null==n&&(n=this.GetKey(t[0])),i&&this._isDisclosing(n)||(l={item:t,key:n},!this.Trigger("beforeCollapse",e,l)&&s||(this.signalTaskStart("Collapse item: "+n),i&&this._setDisclosing(n,!0),r=this.AnimateCollapse(t,n,i,e),this.SetState(t,this.STATE_COLLAPSED),a=this.getCollapseIconStyleClass(),h=this.getExpandIconStyleClass(),t.find("."+h).first().removeClass(h).addClass(a),this.m_items=null,null!=e&&e.stopPropagation(),o&&r.then(function(){u.ojContext._IsCustomElement()&&(c=u.GetOption("expanded"),u._isKeySet(c)&&(d=c.delete([n]),u.SetOption("expanded",d,{_context:{originalEvent:e,internalSet:!0},changed:!0}))),u.Trigger("collapse",e,l)}),this.ojContext._IsCustomElement()||(null==this._collapsedKeys&&(this._collapsedKeys=[]),-1==this._collapsedKeys.indexOf(n)&&this._collapsedKeys.push(n)),r.then(function(){u.signalTaskEnd()}))))},AnimateCollapse:function(t,i,n,s){var o,l,r,a,h,c=0,d=this;return l=new Promise(function(t,e){r=t}),(o=t.children("ul").first())[0].key=i,n?(this.signalTaskStart("Animate collapse"),o.children().each(function(){c+=e(this).outerHeight()}),o.css("maxHeight",c+"px"),(a=this.getAnimationEffect("collapse")).persist="all",this.signalTaskStart("Kick off collapse animation"),h=o.get(0),this.StartAnimation(h,"collapse",a).then(function(t){d._handleCollapseTransitionEnd(o,r)}),this.signalTaskEnd()):(o.css("maxHeight","0px"),this.AnimateCollapseComplete(o),r(null)),l},_handleCollapseTransitionEnd:function(t,e){this.AnimateCollapseComplete(t),e(null),this.signalTaskEnd()},AnimateCollapseComplete:function(t){t.removeClass(this.getGroupExpandStyleClass()).addClass(this.getGroupCollapseStyleClass()),null!=this.m_contentHandler&&this.m_contentHandler.Collapse(t),this._setDisclosing(t[0].key,!1)},_collapseAll:function(){var t;this.signalTaskStart("Collapse all"),t=this,this._getItemsCache().each(function(){t.CollapseItem(e(this),null,!1,null,!1,!1)}),this.signalTaskEnd()},getExpanded:function(){var t,i,n;return t=[],i=this,this._getItemsCache().each(function(){n=e(this),i.GetState(n)==i.STATE_EXPANDED&&t.push(i.GetKey(n[0]))}),t},getWidgetConstructor:function(){return t.Components.__GetWidgetConstructor(this.element)},GetContainerStyleClass:function(){return this._isNonWindowTouch()?"oj-listview oj-listview-container-touch":"oj-listview oj-listview-container"},GetStyleClass:function(){return"oj-listview-element"},getItemStyleClass:function(){return"oj-listview-item"},getFocusedElementStyleClass:function(){return"oj-listview-focused-element"},getItemElementStyleClass:function(){return"oj-listview-item-element"},getGroupItemStyleClass:function(t){return t&&this._isPinGroupHeader()&&this._isPositionStickySupported()?"oj-listview-group-item oj-sticky":"oj-listview-group-item"},getGroupStyleClass:function(){return"oj-listview-group"},getGroupExpandStyleClass:function(){return"oj-listview-collapsible-transition"},getGroupCollapseStyleClass:function(){return this.getGroupExpandStyleClass()},getCollapseIconStyleClass:function(){return"oj-listview-collapse-icon"},getExpandIconStyleClass:function(){return"oj-listview-expand-icon"},getExpandingIconStyleClass:function(){return"oj-listview-expanding-icon"},getEmptyTextStyleClass:function(){return"oj-listview-no-data-message"},getEmptyTextMarkerClass:function(){return"oj-listview-empty-text"},getDepthStyleClass:function(t){return""},getOptionDefaultsStyleClass:function(){return"oj-listview-option-defaults"},_isPositionStickySupported:function(){return this._isTouchSupport()&&t.AgentUtils.getAgentInfo().os===t.AgentUtils.OS.IOS},_preventMouseWheelOverscroll:function(t,e){var i=e.originalEvent.wheelDelta;isNaN(i)||void 0===this.m_contentHandler.hasMoreToFetch||(i<0?this.m_contentHandler.hasMoreToFetch()&&t.scrollTop+t.clientHeight+Math.abs(i)>=t.scrollHeight&&(t.scrollTop=t.scrollHeight,e.preventDefault()):t.scrollTop>0&&t.scrollTop-i<=0&&(t.scrollTop=0,e.preventDefault()))},_getScrollEventElement:function(){var t=this._getScroller();return t==document.body||t==document.documentElement?window:t},_findClosestElementToTop:function(t,e,i){var n,s,o,l,r,a=!1;if(!(0==t.length||e>=t.length)){if(l={index:e,elem:n=t[e],offsetTop:s=n.offsetTop,offset:o=i-s},Math.abs(o)<1)return l;for((r=o>0)?e++:e--;!a&&e>=0&&e=s)){(o<1||!r)&&(l={index:e,elem:n,offsetTop:s,offset:o});break}r&&l.offsetTop==s||(l={index:e,elem:n,offsetTop:s,offset:o}),r?e++:e--}return a||(e=r?t.length-1:0,l.index=e,l.elem=t[e]),l}},_getRootNodeForItems:function(){return this.isCardLayout()?this.element.get(0).firstElementChild.firstElementChild:this.element.get(0)},_getCurrentScrollPosition:function(t){var i,n,s,o,l,r,a,h,c={};return i=this._getScroller(),void 0===t&&(t=i.scrollTop),c.x=this._getScrollX(i),c.y=t,n=this.m_contentHandler.IsHierarchical(),!isNaN(this.m_itemHeight)&&this.m_itemHeight>0&&(s=n?this._getItemsCache():e(this._getRootNodeForItems()).children("li."+this.getItemElementStyleClass()),o=this.GetOption("scrollPosition"),Math.abs(o.y-t)0})),this.m_groupItems},_unpinGroupItem:function(t){e(t).removeClass("oj-pinned"),t.style.top="auto",t.style.width="auto"},_getNextGroupItem:function(t){var e,i;return(i=(e=this._getGroupItemsCache()).index(t))>-1&&it+n)){e=o;break}if(null!=e&&e!=this.m_groupItemToPin)null!=this.m_groupItemToPin&&this._unpinGroupItem(this.m_groupItemToPin),this._pinGroupItem(e,t),this.m_groupItemToPin=e;else if(null!=this.m_groupItemToPin){if(null!=(a=this._getNextGroupItem(this.m_groupItemToPin))&&a.offsetTop<=t+n)return void(this.m_groupItemToPin.style.top=a.offsetTop-n+"px");this.m_groupItemToPin.style.top=t+"px"}}},_getScroller:function(){var t,e;return null!=(t=this.GetOption("scrollPolicyOptions"))&&null!=(e=t.scroller)?e:this._getListContainer().get(0)},_scrollToGroupHeader:function(t){var e,i,n;i=(e=this._getScroller()).scrollTop,null!=this.m_groupItemToPin&&(this._unpinGroupItem(this.m_groupItemToPin),this.m_groupItemToPin=null),n=t.offsetTop,this._isPinGroupHeader()&&this._isPositionStickySupported()&&n0&&e(i).attr("aria-setsize",s).attr("aria-posinset",n.index+1)),this.m_widget.itemRenderComplete(i,n)},t.IteratingDataProviderContentHandler.prototype.afterRenderItemForInsertEvent=function(i,n){var s,o,l,r;this.signalTaskStart("after render item from model insert event"),i.setAttribute("data-oj-context",""),this.afterRenderItem(i,n),s=e(i),o=i.className,i.className="oj-listview-temp-item oj-listview-item-add-remove-transition",this.shouldUseGridRole()||s.children().wrapAll("
      "),(l=s.children().first())[0].className=o,l[0].key=i.key,this.shouldUseGridRole()||(l.attr("role",i.getAttribute("role")),s[0].hasAttribute("aria-selected")&&l.attr("aria-selected",i.getAttribute("aria-selected"))),r=this,t.Context.getContext(i).getBusyContext().whenReady().then(function(){null!=r.m_widget&&(r.signalTaskStart("kick off animation for insert item"),r.m_widget.StartAnimation(i,"add").then(function(t){i.removeAttribute("data-oj-context"),r._handleAddTransitionEnd(n,i)}),r.signalTaskEnd())})},t.IteratingDataProviderContentHandler.prototype._handleScrollerMaxRowCount=function(){t.Logger.error("max count reached")},t.IteratingDataProviderContentHandler.prototype._removeDataSourceEventListeners=function(){var e=this.getDataSource();null!=e&&(e.removeEventListener("mutate",this.m_handleModelMutateEventListener),e.removeEventListener("refresh",this.m_handleModelRefreshEventListener),e instanceof t.TableDataSourceAdapter&&e.destroy())},t.IteratingDataProviderContentHandler.prototype.fetchRows=function(i){var n,s,o,l,r,a,h,c=0;if(this.signalTaskStart("fetching rows"),this.IsReady())return this.m_fetching=!0,t.IteratingDataProviderContentHandler.superclass.fetchRows.call(this,i),o=this.loadTemplateEngine(),this.signalTaskStart("first fetch"),(n={}).size=this._isLoadMoreOnScroll()?this._getFetchSize():-1,s=this,this.m_dataProviderAsyncIterator=this.getDataSource().fetchFirst(n)[Symbol.asyncIterator](),l=this.m_dataProviderAsyncIterator.next(),Promise.all([l,o]).then(function(i){null!=s.m_widget&&(r=i[0],a=i[1],(h=s.getDataSource())instanceof t.TableDataSourceAdapter&&(c=h.offset),0==c&&(a&&s.cleanItems(a),e(s.m_root).empty()),s._handleFetchedData(r,a))},function(t){s._handleFetchError(t),s.signalTaskEnd()}),void this.signalTaskEnd();this.signalTaskEnd()},t.IteratingDataProviderContentHandler.prototype._handleFetchError=function(e){t.Logger.error(e),null!=this.m_widget?(this._isLoadMoreOnScroll()&&this._removeLoadingIndicator(),this.m_widget.renderComplete()):t.Logger.info("handleFetchError: widget has already been destroyed")},t.IteratingDataProviderContentHandler.prototype._handleFetchSuccess=function(t,e,i){var n,s,o,l;if(null!=this.m_widget){for(n=this.m_root.childElementCount,s=document.createDocumentFragment(),o=0;o0){for(t=0;t=t.length?-1:(n=t[i],null!=(s=this.FindElementByKey(n))?e(this.m_root).children().index(s):-1)},t.IteratingDataProviderContentHandler.prototype.handleModelAddEvent=function(t){var e,i,n,s,o,l,r,a;if(null!=this.m_root)if(this.IsReady()){if(this.signalTaskStart("handling model add event"),i=(e=t.detail.add).data,n=[],e.keys.forEach(function(t){n.push(t)}),e.afterKeys&&(s=[],e.afterKeys.forEach(function(t){s.push(t)})),o=this.getTemplateEngine(),l=e.indexes,null!=i&&null!=n&&n.length>0&&i.length>0&&n.length==i.length&&(null==l||l.length==i.length)){for(r=0;r-1&&s.splice(o,1)}),n.length!=s.length){for(r=new Array(s.length),l=0;l"),t.get(0).className="oj-listview-item-add-remove-transition",this.signalTaskStart("kick off animation to remove an item"),o=t.get(0),this.m_widget.StartAnimation(o,"remove").then(function(e){l._handleRemoveTransitionEnd(t,n)}),this.signalTaskEnd()},t.IteratingDataProviderContentHandler.prototype._handleRemoveTransitionEnd=function(t,i){var n,s;null!=this.m_widget&&0!=(n=(t=e(t)).parent()).length?(this.m_widget.itemRemoveComplete(t.get(0)),(s=this.getTemplateEngine())&&s.clean(t.get(0)),t.remove(),0==n.get(0).childElementCount&&this.m_widget.renderComplete(),this.m_widget.enforceSelectionRequired(),i&&this.m_root.focus(),this.signalTaskEnd()):this.signalTaskEnd()},t.IteratingDataProviderContentHandler.prototype.handleModelChangeEvent=function(t){var e,i,n,s,o,l,r,a;if(null!=this.m_root){for(this.signalTaskStart("handling model update event"),n=(e=t.detail.update).data,i=[],e.keys.forEach(function(t){i.push(t)}),s=this.getTemplateEngine(),o=e.indexes,l=0;l